package com.channel.temperature.collect.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.channel.temperature.collect.R
import com.channel.temperature.collect.app.util.MyUtil
import com.channel.temperature.collect.data.response.TaskBean


class TaskEditAdapter : BaseQuickAdapter<TaskBean, BaseViewHolder>(R.layout.item_task_select) {

    override fun convert(holder: BaseViewHolder, item: TaskBean) {
        if (item.isRemote) {
            holder.setText(R.id.typeTV, "(设备)")
        } else {
            holder.setText(R.id.typeTV, "(本地)")
        }
        holder.setText(R.id.time, "" + MyUtil.DateToStr(MyUtil.StrToDate(item.taskTime)))
        holder.setText(R.id.delayTime, "" + item.delayTime + "秒")
        if (item.isSelected) {
            holder.setImageResource(R.id.selectIV, R.mipmap.icon_seleceted)

        } else {
            holder.setImageResource(R.id.selectIV, R.mipmap.icon_unselected)
        }


    }

}